#include "sheetwidgetpg3.h"
#include "ui_sheetwidgetpg3.h"

// CHARACTER MODEL
#include "toccharmodel.h"

SheetWidgetPg3::SheetWidgetPg3(QObject* chModel, QWidget *parent) :
    WidgetWithGdrData(parent),
    ui(new Ui::SheetWidgetPg3)
{
    ui->setupUi(this);

    if ( chModel == 0 )
        ch = new TocCharModel(this);
    else
        ch = chModel;
}

SheetWidgetPg3::~SheetWidgetPg3()
{
    delete ui;
}

void SheetWidgetPg3::setGdrData(QVariantMap* data)
{
    gdrData = data;
}

QObject* SheetWidgetPg3::chModel()
{
    return ch;
}

void SheetWidgetPg3::refreshFromData(QObject* chModel)
{
    ch = chModel;
    QVariant qv = ch->property("Clipboard");
    ui->clipboard->setData(qv);
}

void SheetWidgetPg3::updateData(QObject* chModel)
{
    if ( chModel != 0 && ch != chModel )
        ch = chModel;
    ch->setProperty("Clipboard", ui->clipboard->data());
}
